﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/admin/admin.Master" CodeBehind="Categories.aspx.vb" Inherits="UI.Categories" %>

<%@ Import Namespace="Telerik.Web.UI" %>
<%@ Import Namespace="Telerik.Web.UI.Skins" %>
<%@ Import Namespace="KOR.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <div class="row">
        <div class="span12">
            <div class="widget ">
                <div class="widget-header">
                    <i class="icon-user"></i>
                    <h3>Categories</h3>
                </div>
                <!-- /widget-header -->
                <div class="widget-content">
                    <div class="tabbable">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#formcontrols" data-toggle="tab">Entry Form</a>
                            </li>
                            <li><a href="#jscontrols" data-toggle="tab">Category List</a></li>
                        </ul>

                        <br>

                        <div class="tab-content ">
                            <div class="tab-pane  active" id="formcontrols">
                                <fieldset>

                                    <div class="control-group">
                                        <label class="control-label" for="username">Category Name</label>
                                        <div class="controls">
                                            <asp:TextBox runat="server" ID="txtCategoryName" CssClass="span6"></asp:TextBox>
                                        </div>
                                        <!-- /controls -->
                                    </div>
                                    <!-- /control-group -->
                                    <br />
                                    <div class="form-actions">
                                        <asp:Button runat="server" ID="btnSave" CssClass="btn btn-primary" Text="Save" />
                                        <asp:Button runat="server" ID="btnCancel" CssClass="btn" Text="Cancel" />
                                    </div>
                                    <!-- /form-actions -->
                                </fieldset>
                            </div>

                            <div class="tab-pane" id="jscontrols">
                                <fieldset>
                                    <br />
                                    <telerik:RadGrid runat="server" ID="rgCategories" ViewStateMode="Disabled" DataSourceID="odsCategories" Width="100%"
                                        EnableEmbeddedSkins="false" MasterTableView-EditMode="InPlace"
                                        AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False">
                                        <MasterTableView runat="server" PageSize="50" ClientDataKeyNames="CategoryID" DataSourceID="odsCategories"
                                            DataKeyNames="CategoryID" AllowMultiColumnSorting="true">
                                            <HeaderStyle BorderStyle="None" HorizontalAlign="Center" Font-Bold="true" Font-Underline="true" />
                                            <ItemStyle BorderStyle="None" HorizontalAlign="Center"/>
                                            <AlternatingItemStyle BorderStyle="None" HorizontalAlign="Center"/>
                                            <EditItemStyle BorderStyle="None" HorizontalAlign="Right"/>
                                            <Columns>

                                                <telerik:GridTemplateColumn HeaderText="Title" SortExpression="CategoryName" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                                    <ItemTemplate>
                                                        <div style="font-size: 12px; margin-top: 5px;">
                                                            <asp:LinkButton ID="lbCategoryName" runat="server" Text='<%# ValueOrDefault(Eval("CategoryName"), "").ToString()%>' CommandName="ShowDetails" CommandArgument='<%# CDbl(ValueOrDefault(Eval("CategoryID"), 0))%>' />
                                                        </div>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn HeaderText="Date" SortExpression="CreatedDate" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                                    <ItemStyle Width="120px" />
                                                    <ItemTemplate>
                                                        <div style="font-size: 12px; margin-top: 5px;">
                                                            <asp:Label ID="lbDate" runat="server" Text='<%# FormatDateTime(CDate(ValueOrDefault(Eval("CreatedDate"), Nothing)).ToShortDateString).ToString()%>' />
                                                        </div>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn HeaderText="" SortExpression="">
                                                    <ItemStyle Width="80px" />
                                                    <ItemTemplate>
                                                        <asp:ImageButton runat="server" ID="ibDelete" OnClientClick="return confirm('Are you sure you want to remove this category?');" ImageUrl="~/admin/img/bin.png" Style="width: 20px; height: auto;" CommandName="Delete" CommandArgument='<%# ValueOrDefault(Eval("CategoryID"), "0")%>' />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                            </Columns>
                                        </MasterTableView>
                                        <ClientSettings>
                                            <Selecting AllowRowSelect="true" />
                                            <ClientEvents OnRowDblClick="SearchGridRowDoubleClick" />
                                        </ClientSettings>
                                    </telerik:RadGrid>
                                    <asp:ObjectDataSource ID="odsCategories" runat="server" EnablePaging="true" TypeName="UI.BL.Categories"
                                        SelectMethod="GetCategories" SelectCountMethod="CategoriesCount" SortParameterName="SortBy">
                                        <SelectParameters>
                                            <asp:Parameter Name="searchFor" DefaultValue="" Type="String" />
                                            <asp:Parameter Name="criteria" DefaultValue="" Type="String" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>


                                    <div class="form-actions" style="padding-top:30px;">
                                        <%--<button type="submit" class="btn btn-primary">Save</button>
                                        <button class="btn">Cancel</button>
                                        <button class="btn btn-info">Info</button>
                                        <button class="btn btn-danger">Danger</button>
                                        <button class="btn btn-warning">Warning</button>
                                        <button class="btn btn-invert">Invert</button>
                                        <button class="btn btn-success">Success</button>--%>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /widget-content -->
            </div>
            <!-- /widget -->
        </div>
        <!-- /span8 -->
    </div>

</asp:Content>
